package app;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;
import java.net.*;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;

import data.SocketLoader;

public class App {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Socket s;
		try {
			s = new Socket("bankier.pl", 80);
			BufferedReader is = new BufferedReader(new InputStreamReader(s.getInputStream()));
			BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(s.getOutputStream(), "UTF-8"));
		    wr.write("GET http://www.bankier.pl/inwestowanie/profile/quote.html?symbol=WIG HTTP/1.0\r\n");
		    //wr.write("Host: bankier.pl\r\n");
		    wr.write("\r\n");
		    wr.flush();
			String in;
			while((in = is.readLine()) != null) {
				System.out.print(in);
			}
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
